package com.XinYun.Library.utils.SqlUtils.ResultSetHandlers;

import org.apache.poi.ss.formula.functions.T;

import java.lang.reflect.Field;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * 单列结果
 * @param <T>
 */
public class  ScalarHandler<T> implements ResultSetHandler{

    @Override
    public List<T> handler(ResultSet rs) {
        List<T> sl = new ArrayList<>();
        try {
            while(rs.next()){
                //获取结果集的值
                Object value = rs.getObject(  1);
                sl.add((T)value);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sl;
    }
}
